package library.http.ssl;

import android.support.annotation.NonNull;
import android.text.TextUtils;

/**
 * Created by Mr.Fan on 2017/2/24.
 */

public class SslConfig {

    private String mSslType = "TLS";
    private Object mSslKeySrc;
    private String mSslKeyPassword;
    private String mSslKeyType = "PKCS12";
    private String mSslKeyManagerType = "X509";
    private Object mSslTrustSrc;
    private String mSslTrustPassword;
    private String mSslTrustType = "bks";
    private String mSslTrustManagerType = "X509";

    public SslConfig ssl(@NonNull String sslType) {
        if (!TextUtils.isEmpty(sslType))
            this.mSslType = sslType;
        return this;
    }

    public SslConfig sslKey(@NonNull Object sslKeySrc, @NonNull String sslKeyPassword) {
        this.mSslKeySrc = sslKeySrc;
        this.mSslKeyPassword = sslKeyPassword;
        return this;
    }

    public SslConfig sslKey(@NonNull Object sslKeySrc, @NonNull String sslKeyPassword, @NonNull String sslKeyType, @NonNull String sslKeyManagerType) {
        this.mSslKeySrc = sslKeySrc;
        this.mSslKeyPassword = sslKeyPassword;
        this.mSslKeyType = sslKeyType;
        this.mSslKeyManagerType = sslKeyManagerType;
        return this;
    }

    public SslConfig sslTrust(@NonNull Object sslTrustSrc, @NonNull String sslTrustPassword) {
        this.mSslTrustSrc = sslTrustSrc;
        this.mSslTrustPassword = sslTrustPassword;
        return this;
    }

    public SslConfig sslTrust(@NonNull Object sslTrustSrc, @NonNull String sslTrustPassword, @NonNull String sslTrustType, @NonNull String sslTrustManagerType) {
        this.mSslTrustSrc = sslTrustSrc;
        this.mSslTrustPassword = sslTrustPassword;
        this.mSslTrustType = sslTrustType;
        this.mSslTrustManagerType = sslTrustManagerType;
        return this;
    }

    protected String getSslType() {
        return mSslType;
    }

    protected Object getSslKeySrc() {
        return mSslKeySrc;
    }

    protected String getSslKeyPassword() {
        return mSslKeyPassword;
    }

    protected String getSslKeyType() {
        return mSslKeyType;
    }

    protected String getSslKeyManagerType() {
        return mSslKeyManagerType;
    }

    protected Object getSslTrustSrc() {
        return mSslTrustSrc;
    }

    protected String getSslTrustPassword() {
        return mSslTrustPassword;
    }

    protected String getSslTrustType() {
        return mSslTrustType;
    }

    protected String getSslTrustManagerType() {
        return mSslTrustManagerType;
    }


}
